// pages/post/post.js
const postsData = require('../../data/posts-data.js')

Page({
  /**
   * 页面的初始数据
   */
  data: {
    imageUrls: [
      { url: '/images/wx.png', postId: 3 },
      { url: '/images/vr.png', postId: 4 },
      { url: '/images/iqiyi.png', postId: 5 }
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    console.log(postsData.postList)
    this.setData({ postList: postsData.postList })
  },
  handlePostTap(e) {
    wx.navigateTo({
      url: `/pages/postDetail/postDetail?id=${e.currentTarget.dataset.postId}`
    })
  },
  handleSwiperTap(e) {
    console.log(e)

    wx.navigateTo({
      url: `/pages/postDetail/postDetail?id=${e.target.dataset.postId}`
    })
  }
})
